<template>
  <div class="content-list">
    <ul class="section-content">
      <li class="content-item" v-for="(item,index) in contentList" :key="index" @click="goAlbum(item,item.name)">
        <div class="kuo">
          <img class="item-img" :src="attachImageUrl(item.pic)">
          <div class="mask">
            <svg class="icon">
              <use xlink:href="#icon-bofang"></use>
            </svg>
          </div>
        </div>
        <p class="item-name">{{item.name||item.title}}</p>
      </li>
    </ul>
  </div>
</template>

<script>
  import {mixin} from '../mixins'

  export default {
    name: 'ContentList',
    mixins:[mixin],
    props:['contentList'],
    methods:{
      goAlbum(item,type){
        this.$store.commit('setTempList',item)
        //如果item这个对象有name这个类型，则说明是歌手
        if(type){                   //歌手
          this.$router.push({path:`/singer-album/${item.id}`});
        }else{                      //歌单
          this.$router.push({path:`/song-list-album/${item.id}`});
        }
      }
    }
  }
</script>

<style scoped lang="scss">
  @import "../assets/css/content-list.scss";
</style>
